#pragma once

#include <string>
#include <exception>

namespace anb { namespace net {

class error : public std::exception {
public:
	enum code {
		none = 0,

		connect_failed = 0x10,

		// packet parse exception
		packet_length_exceeded = 0x20,
		packet_read_failed,

		request_timeout,

		// application level exception
		runtime_error = 0x20,
		not_implemented,
		web_request_failed,
	};


	error(code code, const std::string& str);

	virtual const char* what() const;

private:
	code m_code;
	std::string m_str;

	std::string m_what;

};

} }
